#ifndef __BOUNDEDMAILBOX__
#define __BOUNDEDMAILBOX__
#include "Semaphore.h"
#include "Message.h"
//#include "queue.h"
#include <queue>

using namespace std;

class BoundedMailBox
{
  private:
	Semaphore m_full;
	Semaphore m_empty;
	Mutex mut;//for critical section
	int m_maxLength;
	queue<Message*> mailbox;
	
  public:
	//BoundedMailBox();
	BoundedMailBox(int size) ;
	~BoundedMailBox();
	int getMaxSize();
	int getSize();
	void cleanMailBox();
	void setSize(int size);
	bool isEmpty();
	int PutIn(Message* m);
	Message* Extract();
};
#endif
